<template>
	<view class="box">
		<image :src="loginbanner" class="sign-banner"></image>
		<image :src="loginlogo" class="sign-logo"></image>
		<view class="sign-box">
			<h3 style="height: 80rpx; text-align: center;">申请成为合伙人</h3>
			<view class="same-btn account">
				<label class="iconfont iconfonts icon-ym-people"></label>
				<input type="text" v-model="formData.realName" name="Name" id="accountname" placeholder="请输入您的姓名">
			</view>
			<view class="same-btn mobile">
				<label class="iconfont iconfonts icon-cellphone"></label>
				<input type="number" maxlength="11" v-model="formData.mobilePhone" placeholder="请输入您的手机号">
			</view>
			<view style="margin-top: 60rpx;">
				<u-button class="sign-btn" type="primary" @click="onSubmit"
					:disabled="formData.realName=='' || formData.mobilePhone.length!=11">
					提交申请
				</u-button>
			</view>
		</view>
	</view>
</template>

<script>
	import dateTime from '@/components/dateTime/dateTime.vue'

	import config from '@/common/js/config.js'
	import jnpf from '@/common/js/jnpf.js'
	export default {
		components: {
			dateTime
		},
		name: 'customerBase',
		data() {
			return {
				loginbanner: config.Resources.banner.loginbanner,
				loginlogo: config.Resources.banner.loginlogo,
				formData: {
					realName: '',
					mobilePhone: '',
					userId: undefined
				}
			}
		},
		onLoad(options) {
			if (options.id) {
				this.formData.userId = options.id
			}
		},
		methods: {
			/* 表单提交 */
			onSubmit() {
				let url = "/api/Jiushi/Partner";
				let method = "POST";
				let baseUrl = config.Global.baseUrl['api'].apiUrl;
				uni.showLoading({
					mask: true
				})
				uni.request({
					url: baseUrl + url,
					method: 'POST',
					data: this.formData,
					success: res => {
						uni.hideLoading();
						if (res.data.code == '200') {
							uni.showModal({
								title: '提交成功，请等待上级审核',
								icon: "success",
								showCancel: false,
								confirmText: '我知道了',
								success() {
									uni.redirectTo({
										url: "/pages/users/sign-in/sign-in"
									})
								}
							})
						} else {
							uni.showToast({
								title: res.data.msg,
								icon: "none"
							})
						}
					},
					fail: (error) => {
						helper.msg(error.errMsg);
					},
					complete: () => {}
				});


			},
		}
	}
</script>

<style>

</style>